package com.qq.common;

import com.qq.dao.UserDao;
import com.qq.data.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.concurrent.ConcurrentHashMap;

@Component
public class Baseinfo_user {
    @Autowired
    private UserDao userdao;
    @Autowired
    private RedisTemplate redisTemplate;
    public final static String REDIS_PRE_USER = "user:";
    protected ConcurrentHashMap<Integer,User> usersMap = new ConcurrentHashMap<>();

    //用户setbit  标志位，1:在线状态，2:冻结状态，4:是否黄钻,，5:是否异地登陆
    public void loadinfo(){
        List<User> userlist =  userdao.findAll();
        for(User user:userlist){
            usersMap.put(user.getQq(),user);
        }
    }
}
